<template>

  <div class="icons">
    <swiper :options="swiperOption" >
      <swiper-slide>
        <div class="icon" v-for="item of iconsUrls" :key="item.id">
           <div class="iconImage">
              <img class="icon-img-content" :src="item.url" alt="">
          </div>
           <p>{{item.text}}</p>
        </div>
      </swiper-slide>
    </swiper>
  </div>

</template>
<script>
export default {
  data () {
    return {
      iconsUrls: [
        {
          id: '0001',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/95/f3dd6c383aeb3b02.png',
          text: '景点门票'
        },
        {
          id: '0002',
          url:
            'http://img1.qunarzz.com/piao/fusion/1804/ff/fdf170ee89594b02.png',
          text: '必游榜单'
        },
        {
          id: '0003',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/bd/9f7b9b2b60c1502.png',
          text: '踏青赏花'
        },
        {
          id: '0004',
          url:
            'http://img1.qunarzz.com/piao/fusion/1804/5a/13ceb38dcf262f02.png',
          text: '一日游'
        },
        {
          id: '0005',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/76/eb88861d78fb9902.png',
          text: '动植物园'
        },
        {
          id: '0006',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/6c/9e54a8540fee0102.png',
          text: '故宫'
        },
        {
          id: '0007',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/47/c2b659e048b11602.png',
          text: '主题乐园'
        },
        {
          id: '0008',
          url:
            'http://img1.qunarzz.com/piao/fusion/1804/ed/cf572be30fc32f02.png',
          text: '精选'
        },
        {
          id: '0009',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/e3/67df61427c8e1302.png',
          text: '演出'
        },
        {
          id: '0010',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/96/c70f1e85ae4a4f02.png',
          text: '自然风光'
        },
        {
          id: '0011',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/20/831d62d2e1c7be02.png',
          text: '名胜古迹'
        },
        {
          id: '0012',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/dd/cce1231836f10a02.png',
          text: '周边游'
        },
        {
          id: '0013',
          url:
            'http://img1.qunarzz.com/piao/fusion/1803/b6/37560ece9c62b502.png',
          text: '城市观光'
        }
      ]
    }
  },
  computed: {
    pages () {
      const pages = []
      this.iconsUrls.forEach((item, index) => {
        const page = Math.floor(index / 8)
        if (!page[page]) {
          pages[page] = []
        }
        pages[page].push(item)
      })
      return pages
    }
  }
}
</script>
<style lang="scss" scoped>
.icons >>> .swiper-container {
  height: 0;
  padding-bottom: 50%;
}

.icon {
  text-align: center;
  overflow: hidden;
  float: left;
  width: 25%;
  height: 0;
  padding-bottom: 25%;
  background: pink;
}
.icon-img-content {
  margin-top: 20px;
  width: 65%;
  height: 65%;
}
</style>
